<?php
##############################################
#
#   讨论列表
# @ Time : 2017-1-8 - 下午9:20:27
# @ Author : JiangYongWei <1085562810@qq.com>
# @ Encoding : UTF-8 language : PHP
#
##############################################


namespace Admin\Model;

class DiscussModel extends AdminBaseModel{
	/*讨论表  */
	protected $tableName = 'discuss';	
	
	public function __construct($tableName=''){
		//初始化数据库对象
		if(!empty($tableName)){
			$this -> tableName = $tableName;
		}	
		parent::__construct($this -> tableName);
	}
	
	/**
	 * 获取讨论
	 */
	public function getDiscuss($activity_id){
	    $map = array('activity_id'=>$activity_id);
	    $count = $this->where($map)->count();// 查询满足要求的总记录数
	    $Page = new \Think\Page($count, 1);
	    $show = $Page->show();
	    $result = $this->where($map)->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
		return array($result, $show);
	}
	
	
	
}